'use strict';

angular.module('app')
    .factory('svcState', ['$rootScope', '$window', function ($rootScope, $window) {

        var svcState = {};

        svcState.getLoginUser = function () {
            return this.loginUser;
        };

        svcState.setLoginUser = function (loginUser) {
            this.loginUser = loginUser;
        };

        svcState.gotoLogin = function () {
            $window.location = '/#login';
        };

        svcState.isLoggedIn = function () {
            return (this.loginUser != undefined && this.loginUser.length > 2);
        };

        return svcState;
    }])

;